home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / sources / volumetest.cp < prev    next >
Encoding:
Text File  |  2000-06-23  |  2.5 KB  |  77 lines

  1. /*
  2.     File:        VolumeTest.cp
  3.  
  4.     Contains:    TVolume is a simple volume based utility class (provides information about volumes)     
  5.                   TVolumeTest.cp contains the TVolume testing functions.
  6.  
  7.     Written by: Kent Sandvik    
  8.  
  9.     Copyright:    Copyright © 1993-1999 by Apple Computer, Inc., All Rights Reserved.
  10.  
  11.                 You may incorporate this Apple sample source code into your program(s) without
  12.                 restriction. This Apple sample source code has been provided "AS IS" and the
  13.                 responsibility for its operation is yours. You are not permitted to redistribute
  14.                 this Apple sample source code as "Apple sample source code" after having made
  15.                 changes. If you're going to re-distribute the source, we require that you make
  16.                 it clear in the source that the code was descended from Apple sample source
  17.                 code, but that you've made changes.
  18.  
  19.     Change History (most recent first):
  20.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  21.                 
  22.  
  23. */
  24. #ifndef _VOLUME_
  25. #include "Volume.h"
  26. #endif
  27.  
  28.  
  29. // This test will first look at the boot volume, and print out information
  30. // about the volume structure.
  31.  
  32. void main(void)
  33. {
  34.     cout << "Start of the TVolume object test…\n";
  35.  
  36.     // Create a TVolume object.
  37.     TVolume myVolumes;
  38.  
  39.     // Print out default (boot volume) information.
  40.     cout << "VRefNum of boot volume is = " << myVolumes.GetBootVRefNum() << '\n';
  41.     cout << "Free space (K) of boot volume is = " << myVolumes.GetKFreeSpace() << '\n';
  42.     cout << "Num files on boot volume is = " << myVolumes.GetFileCount() << '\n';
  43.     cout << "Num folders on boot volume is = " << myVolumes.GetDirCount() << '\n';
  44.     cout << "Cretion date of boot volume is = " << myVolumes.GetCreationDate() << '\n';
  45.     cout << "Driver number of boot volume is = " << myVolumes.GetDriverNumber() << '\n';
  46.  
  47.  
  48.     // Get volume name.
  49.     Str255 name;
  50.     myVolumes.GetName(name);
  51.     p2c(name);
  52.     printf("Name of boot volume is = %s\n", name);
  53.  
  54.     // Iterate through the volumes
  55.     cout << "Num volumes mounted is = " << myVolumes.GetNumVolumes() << '\n';
  56.  
  57.     // show file num information on each mounted volume.
  58.     for (myVolumes.Reset(); !myVolumes.Last(); myVolumes.Next())
  59.     {
  60.         cout << "Num files on volume = " << myVolumes.GetFileCount() << '\n';
  61.         cout << "Free space (K) of  volume is = " << myVolumes.GetKFreeSpace() << '\n';
  62.         cout << '\n';
  63.     }
  64.  
  65.     cout << "End of the TVolume object test!\n";
  66. }
  67.  
  68.  
  69. // _________________________________________________________________________________________________________ //
  70.  
  71.  
  72. /*    Change History (most recent last):
  73.   No        Init.    Date        Comment
  74.   1            khs        1/5/93        New file
  75.   2            khs        1/7/93        Cleanup
  76. */
  77.